﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.S.NewMedical.Infrastructure.Interface
{
    /// <summary>
    /// 基础操作接口层
    /// </summary>
    public interface IBaseRepository<T> where T : class
    {
        /// <summary>
        /// 根据主键查询
        /// </summary>
        /// <param name="id">主键</param>
        /// <returns>返回model实体</returns>
        Task<T> GetValue(int id);
        /// <summary>
        /// 查询所有数据
        /// </summary>
        /// <returns>返回所有数据</returns>
        IQueryable<T> GetAll();
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="t">实体</param>
        /// <returns>返回成功或失败</returns>
        Task<int> CreateAsync(T t);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="t">实体</param>
        /// <returns>返回成功或失败</returns>
        Task<int> UpdateAsync(T t);
        /// <summary>
        /// 批量修改
        /// </summary>
        /// <param name="values"></param>
        /// <returns></returns>
        Task<int> UpdateRangAsync(List<T> values);
    }
}
